package com.lzp.androidprojects;

import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.lzp.androidprojects.simple1.base.BaseActivity;
import com.lzp.androidprojects.simple1.model.Main2Model;
import com.lzp.androidprojects.simple1.presenter.MainPresenter;
import com.lzp.androidprojects.simple1.view.MvpView;

import java.util.List;

public class MainActivity extends BaseActivity<MvpView, MainPresenter> implements MvpView{

    private ListView listView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        listView = findViewById(R.id.listview);
        basePresenter.setMvpModel(new Main2Model()).getData();
    }

    @Override
    public MainPresenter getBasePresenter() {
        return new MainPresenter();
    }

    @Override
    public void showData(List<String> list) {
        ArrayAdapter arrayAdapter = new ArrayAdapter(this,android.R.layout.simple_list_item_1,list);
        listView.setAdapter(arrayAdapter);
    }
}
